﻿using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RabbitMQ.Publisher.Send
{
    class Program
    {
        static void Main(string[] args)
        {
            var factory = new ConnectionFactory() { HostName = "localhost" };
            using (var connection = factory.CreateConnection())
            {
                using (var chanel = connection.CreateModel())
                {
                    chanel.ExchangeDeclare(exchange: "logs", type: "fanout");
                    for (int i = 0; i < 10000; i++)
                    {
                        var message = "Hello" + i + "...";
                        chanel.BasicPublish(exchange: "logs", routingKey: "", basicProperties: null, body: Encoding.UTF8.GetBytes(message));
                    }

                    Console.WriteLine("Press [Enter] to exist.");
                    Console.ReadKey();
                }
            }
        }
    }
}
